// 定义 store

import { defineStore } from "pinia"

export const user = defineStore("product", {
    state() {
        return {
            products:[]
        }
    },
    actions:{
        async fetch_data(a,b){
        try{
            let res = await fetch("http://chst.vip/data/index.json")
            .then(body=>body.json())
               console.log(res);
               this.products = res.data
        }catch(e){
            console.log(e);
        }
           
        }
    }
})